<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<title>数据项列表</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="shortcut icon" href="${ctx }/ico/favicon.ico">
<link href="${ctx }/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
<link href="${ctx }/css/font-awesome.css?v=4.4.0" rel="stylesheet">

<!-- jqgrid-->
<link href="${ctx }/css/plugins/jqgrid/ui.jqgrid.css?0820"
	rel="stylesheet">

<link href="${ctx }/css/animate.css" rel="stylesheet">
<link href="${ctx }/css/common.css" rel="stylesheet">
<link href="${ctx }/css/style.css?v=4.1.0" rel="stylesheet">
<!-- Sweet Alert -->
<link href="${ctx }/css/plugins/sweetalert/sweetalert.css"
	rel="stylesheet">
<link
	href="${ctx}/css/plugins/bootstrap-select/bootstrap-select.min.css"
	rel="stylesheet" />
<!-- bootstrap-switch css -->
<link href="${ctx }/css/plugins/bootstrap-switch/bootstrap-switch.css"
	rel="stylesheet">
<style type="text/css">
  .row-right{
    padding-left: 0;
  }
  .row-left{
    padding-right: 0;
  }
  .control-label{
    padding-right: 0;
  }
  .input-left{
    padding-right: 0;
  }
  .input-right{
    padding-left:0;
  }
  #table_list td{
  	text-align: center;
  }
@media (min-width: 850px){
.modal-dialog{
  width:848px;
}
}


</style>
</head>
<body class="gray-bg">
	<div class="animated fadeInRight">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox ">
					<div class="ibox-content">
						<div class="row m-b-sm m-t-sm">
							<div class="col-md-11">
								<div class="input-group">
									<button class="btn btn-success btn-outline commonbtn" type="button"
										id="addDictItem">
										<i class="fa fa-plus"></i> 添加
									</button>
									<button class="btn btn-success btn-outline commonbtn" type="button"
										id="editDictItem">
										<i class="fa fa-pencil"></i> 编辑
									</button>
									<button class="btn btn-success btn-outline commonbtn" type="button"
										id="delDictItem">
										<i class="fa fa-trash"></i> 删除
									</button>
								</div>
							</div>
						</div>
						<div>
								<table id="table_list"></table>
						</div>
						<div id="pager_list"></div>
						<!-- <div style="overflow-x:auto"><table id="treegrid2"></table></div> -->
					</div>
				</div>
			</div>
		</div>
	</div>


	<!-- 添加菜单模态窗口 -->
	<div class="modal inmodal" id="addDictItemWin" tabindex="-1" role="dialog"
		aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content animated bounceInRight">
				<div class="modal-header">
					<button type="button" class="close closeWin" data-dismiss="modal">
						<span aria-hidden="true">&times;</span><span class="sr-only">关闭</span>
					</button>
					<h5 class="modal-title">数据项配置</h5>
				</div>

				<div class="ibox-content">
					<form class="form-horizontal m-t" id="addDictItemForm">
                        
                        <input type="hidden" id="pk_dict_id" name="pk_dict_id" value="${pk_dict_id}"/>
                        <!-- 场景ID -->
                        <input type="hidden" id="pk_scene_id" name="pk_scene_id" value="${pk_scene_id}"/>
                        
						<div class="form-group">
                          <div class="row">
                            <div class="col-sm-6 row-left">
    							<label class="col-sm-4 control-label">数据项名称：</label>
    							<div class="col-sm-8 input-left" >
						            <input id = "item_name" name = "item_name" class="form-control" 
						            required="" aria-required="true" type="text">                        
    							</div>
                             </div>
                             <div class="col-sm-6 row-right">
                                <label class="col-sm-4 control-label">管理部门：</label>
                                <div class="col-sm-8 input-right" >
	                                <select id="org_id" name="org_id" class="selectpicker" required="" aria-required="true">
	                                 <option value="">--请选择--</option>
	                                 <c:forEach items="${olist}" var="orgInfo">
	                                   <option value="${orgInfo.org_id}">${orgInfo.org_name}</option>
	                                 </c:forEach>
	                                </select>
	                            </div>
                             </div>
                          </div>
						</div>
					    
              
                        <div class="form-group">
                          <div class="row">
                            <div class="col-sm-6 row-left">
                              <label class="col-sm-4 control-label">起始系统：</label>
                              	 <div class="col-sm-8 input-left" >
								<select class="selectpicker" required="" aria-required="true"
									name="initial_system" id="initial_system">
									<option value="">--请选择--</option>
									<c:forEach items="${dictlist}" var="dictInfo">
										<option value="${dictInfo.dictname}">${dictInfo.dictname}</option>
									</c:forEach>
								</select>
							</div>
                             </div>
                             <div class="col-sm-6 row-right">
                                <label class="col-sm-4 control-label">目标系统：</label>
                                <div class="col-sm-8 input-right" >
                                <select class="selectpicker" required="" aria-required="true"
									name="target_system" id="target_system">
									<option value="">--请选择--</option>
									<c:forEach items="${dictlist}" var="dictInfo">
										<option value="${dictInfo.dictname}">${dictInfo.dictname}</option>
									</c:forEach>
								</select>
								</div>
                             </div>
                          </div>
                       </div>
                       
                       <div class="form-group">
                          <div class="row">
                            <div class="col-sm-6 row-left">
                              <label class="col-sm-4 control-label">起始用户：</label>
                              <div class="col-sm-8 input-left" >
                                <input id="initial_user" name="initial_user" class="form-control"
                                   aria-required="true" type="text">
                              </div>
                             </div>
                             <div class="col-sm-6 row-right">
                                <label class="col-sm-4 control-label">目标用户：</label>
                                <div class="col-sm-8 input-right">
                                  <input id="target_user" name="target_user" class="form-control"
                                     aria-required="true" type="text">
                                </div>
                             </div>
                          </div>
                       </div>
                       <div class="form-group">
                          <div class="row">
                            <div class="col-sm-6 row-left">
                              <label class="col-sm-4 control-label">起始表名称：</label>
                              <div class="col-sm-8 input-left" >
                                <input id="initial_table_name" name="initial_table_name" class="form-control"
                                   aria-required="true" type="text">
                              </div>
                             </div>
                             <div class="col-sm-6 row-right">
                                <label class="col-sm-4 control-label">目标表名称：</label>
                                <div class="col-sm-8 input-right">
                                  <input id="target_table_name" name="target_table_name" class="form-control"
                                     aria-required="true" type="text">
                                </div>
                             </div>
                          </div>
                       </div>
                       <div class="form-group">
                          <div class="row">
                            <div class="col-sm-6 row-left">
                              <label class="col-sm-4 control-label">起始主键：</label>
                              <div class="col-sm-8 input-left" >
                                <input id="initial_primary_key" name="initial_primary_key" class="form-control"
                                   aria-required="true" type="text">
                              </div>
                             </div>
                             <div class="col-sm-6 row-right">
                                <label class="col-sm-4 control-label">目标主键：</label>
                                <div class="col-sm-8 input-right">
                                  <input id="target_primary_key" name="target_primary_key" class="form-control"
                                     aria-required="true" type="text">
                                </div>
                             </div>
                          </div>
                       </div>
                       
                       <div class="form-group">
                          <div class="row">
                            <div class="col-sm-6 row-left">
                              <label class="col-sm-4 control-label">增量监控sql：</label>
                              <div class="col-sm-8 input-left" >
                                <textarea id="sql_increment_monitor" rows="3" cols="50" name="sql_increment_monitor" class="form-control"
                                   aria-required="true" ></textarea>
                              </div>
                             </div>
                             <div class="col-sm-6 row-right">
                                <label class="col-sm-4 control-label">全量标识sql：</label>
                                <div class="col-sm-8 input-right">
                                  <textarea id="sql_total_identifier"  rows="3" cols="50"name="sql_total_identifier" class="form-control"
                                     aria-required="true"></textarea>
                                </div>
                             </div>
                          </div>
                       </div>
                       
                       <div class="form-group">
                          <div class="row">
                            <div class="col-sm-6 row-left">
                              <label class="col-sm-4 control-label">增量标识：</label>
                              <div class="col-sm-8 input-left" >
                                <input id="increment_identifier" name="increment_identifier" class="form-control"
                                   aria-required="true" type="text">
                              </div>
                             </div>
                             <div class="col-sm-6 row-right">
                                <label class="col-sm-4 control-label">全量标识：</label>
                                <div class="col-sm-8 input-right">
                                  <input id="total_identifier" name="total_identifier" class="form-control"
                                     aria-required="true" type="text">
                                </div>
                             </div>
                          </div>
                       </div>
                       
                       <div class="form-group">
                          <div class="row">
                            <div class="col-sm-6 row-left">
                              <label class="col-sm-4 control-label">增量标识监控sql：</label>
                              <div class="col-sm-8 input-left" >
                                <textarea id="sql_incre_identifer_monitor" rows="3" cols="50" name="sql_incre_identifer_monitor" class="form-control"
                                   aria-required="true"></textarea>
                              </div>
                             </div>
                             <div class="col-sm-6 row-right">
                                <label class="col-sm-4 control-label">全量标识监控sql：</label>
                                <div class="col-sm-8 input-right">
                                  <textarea id="sql_total_identifier_monitor" rows="3" cols="50" name="sql_total_identifier_monitor" class="form-control"
                                     aria-required="true"></textarea>
                                </div>
                             </div>
                          </div>
                       </div>
                       
                       <div class="form-group">
                          <div class="row">
                            <div class="col-sm-6 row-left">
                              <label class="col-sm-4 control-label">增量当前值：</label>
                              <div class="col-sm-8 input-left" >
                                <input id="increment_value" name="increment_value" class="form-control"
                                   aria-required="true" type="text">
                              </div>
                             </div>
                             <div class="col-sm-6 row-right">
                                <label class="col-sm-4 control-label">全量当前值：</label>
                                <div class="col-sm-8 input-right">
                                  <input id="total_value" name="total_value" class="form-control"
                                     aria-required="true" type="text">
                                </div>
                             </div>
                          </div>
                       </div>
                       
                        <div class="form-group">
                          <div class="row">
                            <div class="col-sm-6 row-left">
                              <label class="col-sm-4 control-label">起始连接方式：</label>
                              <div class="col-sm-8 input-left" >
                                <input id="initial_link" name="initial_link" class="form-control"
                                   aria-required="true" type="text">
                              </div>
                             </div>
                             <div class="col-sm-6 row-right">
                                <label class="col-sm-4 control-label">目标连接方式：</label>
                                <div class="col-sm-8 input-right">
                                  <input id="target_link" name="target_link" class="form-control"
                                     aria-required="true" type="text">
                                </div>
                             </div>
                          </div>
                       </div>
                       <div class="form-group">
                          <div class="row">
                            <div class="col-sm-6 row-left">
                              <label class="col-sm-4 control-label">起始系统时间字段：</label>
                              <div class="col-sm-8 input-left" >
                                <input id="initial_timekey" name="initial_timekey" class="form-control"
                                  type="text">
                              </div>
                             </div>
                             <div class="col-sm-6 row-right">
                                <label class="col-sm-4 control-label">目标系统时间字段：</label>
                                <div class="col-sm-8 input-right">
                                  <input id="target_timekey" name="target_timekey" class="form-control"
                                     type="text">
                                </div>
                             </div>
                          </div>
                       </div>
                       <div class="form-group">
                          <div class="row">
                            <div class="col-sm-6 row-left">
                              <label class="col-sm-4 control-label">一致性监控状态：</label>
							  <div class="col-sm-2">
								<div class="switch has-switch">
									<div id="share_switch_div_consistency" class="switch-on switch-animate">
										<input id="consistency_flag_input" 
												type="checkbox" checked="checked">
									</div>
								</div>
								<input id="consistency_flag" name="consistency_flag" type="hidden">
							  </div>
                             </div>
                             
                            <div class="col-sm-6 row-left">
                              <label class="col-sm-4 control-label">完整性监控状态：</label>
							  <div class="col-sm-2">
								<div class="switch has-switch">
									<div id="share_switch_div_integrity" class="switch-on switch-animate">
										<input id="integrity_flag_input" 
												type="checkbox" checked="checked">
									</div>
								</div>
								<input id="integrity_flag" name="integrity_flag" type="hidden">
							  </div>
                             </div>
                          </div>
                       </div>
                       
                       <div class="form-group">
                          <div class="row">
                            <div class="col-sm-6 row-left">
                              <label class="col-sm-4 control-label">准确性监控状态：</label>
							  <div class="col-sm-2">
								<div class="switch has-switch">
									<div id="share_switch_div_accuracy" class="switch-on switch-animate">
										<input id="accuracy_flag_input" 
												type="checkbox" checked="checked">
									</div>
								</div>
								<input id="accuracy_flag" name="accuracy_flag" type="hidden">
							  </div>
                             </div>
                               <div class="col-sm-6 row-left">
                              <label class="col-sm-4 control-label">运行状态：</label>
							  <div class="col-sm-2">
								<div class="switch has-switch">
									<div id="switch_run_div" class="switch-on switch-animate">
										<input id="switch_run_input" 
												type="checkbox" checked="checked">
									</div>
								</div>
								<input id="switch_run" name="switch_run" type="hidden">
							  </div>
                             </div>
                          </div>
                       </div>
                       
                       
                       <div class="form-group">
                        <div class="col-sm-8 col-sm-offset-4">
                          <button type="button" class="btn btn-white" data-dismiss="modal" style="margin-left: 50px;margin-right:15px;">关闭</button>
                          <button type="submit" class="btn btn-primary"
                            id="add_SysCode_submit">保存</button>
                        </div>
                      </div>
					</form>
				</div>

			</div>
		</div>
	</div>
	<!--end 添加代码模态窗口 -->


	<!-- 修改代码模态窗口 -->
	<div class="modal inmodal" id="editDictItemWin" role="dialog"
		aria-hidden="true">
		<iframe id="editDictItemFrame" width="100%" height="100%"
			frameborder="0"></iframe>
	</div>
	<!--end 修改菜单模态窗口 -->
	<!-- 查看规则模态窗口 -->
	<div class="modal inmodal" id="queryDictRouteWin" role="dialog"
		aria-hidden="true">
		<iframe id="queryDictRouteFrame" width="100%" height="100%"
			frameborder="0"></iframe>
	</div>
	<!--end 查看规则模态窗口 -->
	<!-- 全局js -->
	<script src="${ctx }/js/jquery.min.js?v=2.1.4"></script>
	<script src="${ctx }/js/bootstrap.min.js?v=3.3.6"></script>

	<!-- Peity -->
	<script src="${ctx }/js/plugins/peity/jquery.peity.min.js"></script>

	<!-- jqGrid -->
	<script src="${ctx }/js/plugins/jqgrid/i18n/grid.locale-cn.js?0820"></script>
	<script src="${ctx }/js/plugins/jqgrid/jquery.jqGrid.min.js?0820"></script>

	<!-- jQuery Validation plugin javascript-->
	<script src="${ctx }/js/plugins/validate/jquery.validate.min.js"></script>
	<script src="${ctx }/js/plugins/validate/messages_zh.min.js"></script>

	<!-- layer javascript -->
	<script src="${ctx }/js/plugins/layer/layer.min.js"></script>

	<!-- jQuery form-->
	<script src="${ctx }/js/jquery.form.js"></script>


	<!-- 自定义js -->
	<script src="${ctx }/js/content.js?v=1.0.0"></script>
	<!-- Sweet alert -->
	<script src="${ctx }/js/plugins/sweetalert/sweetalert.min.js"></script>
	<script
		src="${ctx}/js/plugins/bootstrap-select/bootstrap-select.min.js"></script>
	<!-- bootstrap-switch js -->
	<script src="${ctx }/js/plugins/bootstrap-switch/bootstrap-switch.js"></script>
	<script>
		$(document).ready(function() {
			$.jgrid.defaults.styleUI = 'Bootstrap';
			
			//绑定表格数据
			$("#table_list").jqGrid({
				url : "${ctx }/monit_item/dict_item_page?pk_scene_id=${pk_scene_id}&pk_dict_id=${pk_dict_id}",
				datatype : "json",
				//height : "calc(100% - 300px)",
				height : $(window).height()-270,
				autowidth : true,
				shrinkToFit : false,
				multiselect : true,
				rowList : [ 10, 20, 30 ],
				root : "rows",
				colNames : [ '主键ID','数据项名称', '起始系统', '目标系统','起始用户', '目标用户' ,'起始表名称','目标表名称','起始主键','目标主键','增量监控sql','全量标识sql','增量标识','全量标识','增量标识监控sql','全量标识监控sql','增量当前值','全量当前值','起始连接方式','目标连接方式','一致性监控状态','完整性监控状态','准确性监控状态','运行状态'],
				colModel : [
					{name:'id',index:'id',width : 100,hidden:true,algin : 'center'},
					{name:'item_name',index:'item_name',width : 100,algin : 'center'},
					{name:'initial_system',index:'initial_system',width : 100,algin : 'center'},
					{name:'target_system',index:'target_system',width : 100,algin : 'center'},
					{name:'initial_user',index:'initial_user',width : 100,algin : 'center'},
					{name:'target_user',index:'target_user',width : 100,algin : 'center'},
					{name:'initial_table_name',index:'initial_table_name',width : 100,algin : 'center'},
					{name:'target_table_name',index:'target_table_name',width : 100,algin : 'center'},
					{name:'initial_primary_key',index:'initial_primary_key',width : 100,algin : 'center'},
					{name:'target_primary_key',index:'target_primary_key',width : 100,algin : 'center'},
					{name:'sql_increment_monitor',index:'sql_increment_monitor',width : 100,algin : 'center',
						formatter:function(cellvalue, options, rowObject){
							if(cellvalue != null)
								return cellvalue.replace(/[\r\n]/g,"");
							return "";
						}	
					},
					{name:'sql_total_identifier',index:'sql_total_identifier',width : 100,algin : 'center',
						formatter:function(cellvalue, options, rowObject){
							if(cellvalue != null)
								return cellvalue.replace(/[\r\n]/g,"");
							return "";
						}	
					},
					{name:'increment_identifier',index:'increment_identifier',width : 100,algin : 'center'},
					{name:'total_identifier',index:'total_identifier',width : 100,algin : 'center'},
					{name:'sql_incre_identifer_monitor',index:'sql_incre_identifer_monitor',width : 150,algin : 'center',
						formatter:function(cellvalue, options, rowObject){
							if(cellvalue != null)
								return cellvalue.replace(/[\r\n]/g,"");
							return "";
						}	
					},
					{name:'sql_total_identifier_monitor',index:'sql_total_identifier_monitor',width : 150,algin : 'center',
						formatter:function(cellvalue, options, rowObject){
							if(cellvalue != null)
								return cellvalue.replace(/[\r\n]/g,"");
							return "";
						}	
					},
					{name:'increment_value',index:'increment_value',width : 100,algin : 'center'},
					{name:'total_value',index:'total_value',width : 100,algin : 'center'},
					{name:'initial_link',index:'initial_link',width : 120,algin : 'center'},
					{name:'target_link',index:'target_link',width : 120,algin : 'center'},
					{name:'consistency_flag',index:'consistency_flag',width : 130,algin : 'center',
						formatter : function(cellvalue, options, rowObject) {
							if(rowObject.consistency_flag == 0){
								return '关闭';
							}else{
								return '开启';
							}
						}	
					},
					{name:'integrity_flag',index:'integrity_flag',width : 130,algin : 'center',
						formatter : function(cellvalue,options,rowObject){
							if(rowObject.integrity_flag == 0){
								return '关闭';
							}else{
								return '开启';
							}
						}	
					},
					{name:'accuracy_flag',index:'accuracy_flag',width : 130,algin : 'center',
						formatter : function(cellvalue,options,rowObject){
							if(rowObject.accuracy_flag == 0){
								return '关闭';
							}else{
								return '开启';
							}
						}		
					},
					{name:'switch_run',index:'switch_run',width : 130,algin : 'center',
						formatter : function(cellvalue,options,rowObject){
							if(rowObject.switch_run==null||rowObject.switch_run == 0){
								return '关闭';
							}else{
								return '开启';
							}
						}		
					},
				  ],
				
				  	sortable : true,
					sortname : 'insert_time',
					sortorder : 'desc',
					pager : "#pager_list",
					caption : "数据项列表",
					viewrecords : true,
					ondblClickRow:function(row){
						var frameSrc = "${ctx}/monit_dict/queryDictRoure?pk_item_id="+ row;
						$("#queryDictRouteFrame").attr("src", frameSrc);
						$('#queryDictRouteWin').modal('show');
					},
					loadComplete: function () {
						scrollX();
					}/* ,
					loadComplete : function() {
					    var grid = $("#table_list");
					    var ids = grid.getDataIDs();
					    for (var i = 0; i < ids.length; i++) {
					    	console.log(ids[i]);
					        grid.setRowData (ids[i], false, {height: 35}); //设置成你要设定的固定行高
					    }
					}  */
			}); 
		});
		$("#pager_list_center").css("width","50%")
		// jqGrid 自动调整宽度
		$(window).bind('resize', function() {
			var width = $('.jqGrid_wrapper').width();
			$('#table_list').setGridWidth(width);
			
			$(window).unbind("onresize");  
		   var height = $(window).height();
		   $("#table_list").setGridHeight(height-270);  
		   $(window).bind("onresize", this);
			scrollX();
		});

		//绑定add表单提交事件,异步提交表单
		$('#addDictItemForm')
				.submit(
						function() {
							console.log($('#addDictItemForm').serialize())
							var fromUrl = "${ctx }/monit_item/add_dict_item";
							$
									.ajax({
										type : "post",
										url : fromUrl,
										data : $('#addDictItemForm').serialize(),
										success : function(data) {
											if (data.errcode == "0") {
												layer.alert(data.errmsg,
														{
													     icon : 1	
														},		
												function(index) {
														//刷新表格数据
													$("#table_list").trigger("reloadGrid");
														//清空表单数据
													$("#addDictItemForm :input").not(
														":button, :submit, :reset, :hidden").val("")
													.removeAttr("checked")
													.remove("selected");
												//关闭add窗口
												$('#addDictItemWin').modal('hide');
												//关闭提示框
												layer.close(index);
											});
											} else {
												layer.alert(data.errmsg, {
													icon : 2
												})
											}

										},
										error : function() {
											layer.alert('添加业务场景配置失败！', {
												icon : 2
											});
										}
									});
							return false;
						});

		//绑定修改按钮事件
		$('#addDictItem').click(function() {
			$('#addDictItemWin').modal('show');
		});
		//绑定修改按钮事件
		$('#editDictItem').click(
				function() {
					var selectedId = $("#table_list").jqGrid("getRowData",$("#table_list").jqGrid("getGridParam", "selarrrow")).id;
					if (selectedId == null || selectedId == "") {
						layer.alert('请选择一项！', {
							icon : 0
						});
						return;
					}
					var frameSrc = "${ctx}/monit_item/edit_dict_item?id="+ selectedId+"&pk_scene_id=${pk_scene_id}";
					$("#editDictItemFrame").attr("src", frameSrc);
					$('#editDictItemWin').modal('show');
				});

		function editWinClose(flag) {
			if (flag == "0") {
				$("#table_list").trigger("reloadGrid");
				//关闭edit窗口
				$("#editDictItemFrame")[0].contentWindow.document.write('');
				$("#editDictItemFrame")[0].contentWindow.close();
				$('#editDictItemWin').modal('hide');
			}else{
				$("#queryDictRouteFrame")[0].contentWindow.document.write('');
				$("#queryDictRouteFrame")[0].contentWindow.close();
				$('#queryDictRouteWin').modal('hide');
			}
			
			
		}

		//绑定删除事件
		$('#delDictItem').click(
				function() {
					var selectedIds = $("#table_list").jqGrid("getGridParam",
							"selarrrow");
					var v_id = "";
					for (var i = 0; i < selectedIds.length; i++) {

						v_id = $("#table_list").jqGrid("getRowData",
								selectedIds[i]);
					}

					if (selectedIds == "") {
						layer.alert('请选择一项！', {
							icon : 0
						});
						return;
					}
					swal({
						title : "您确定要删除这条信息吗",
						text : "删除后将无法恢复，请谨慎操作！",
						type : "warning",
						showCancelButton : true,
						confirmButtonColor : "#DD6B55",
						confirmButtonText : "删除",
						closeOnConfirm : false
					}, function() {
						$.ajax({
							type : "post",
							dataType : "json",
							url : "${ctx }/monit_item/delete_by_id",
									
							data : "ids="+selectedIds,
							success : function(data) {
								if (data.errcode == "0") {
									//刷新表格数据
									$("#table_list").trigger("reloadGrid");
									swal("删除成功！", "您已经永久删除了这条信息。", "success");
								} else {
									swal("删除数据字典失败！", "您未删除这条信息。", "error");
								}
							},
							error : function() {
								swal("删除数据字典失败！", "您未删除这条信息。", "error");
							}
						});
					});
				});
		

		//准确性监控开关
		$('#share_switch_div_accuracy input').bootstrapSwitch({
			onText : "ON",
			offText : "OFF",
			onColor : "primary",
			offColor : "danger",
			size : "small",
			state : false,
			onInit : function(event, state) {//初始化开关
				$("#accuracy_flag").val("0");
			},
			onSwitchChange : function(event, state) {//开关状态发生改变时
				if (state == true) {
					$("#accuracy_flag").val("1");
				} else {
					$("#accuracy_flag").val("0");
				}
			}
		}); 
		
		//一致性监控开关
		$('#share_switch_div_consistency input').bootstrapSwitch({
			onText : "ON",
			offText : "OFF",
			onColor : "primary",
			offColor : "danger",
			size : "small",
			state : false,
			onInit : function(event, state) {//初始化开关
				$("#consistency_flag").val("0");
			},
			onSwitchChange : function(event, state) {//开关状态发生改变时
				if (state == true) {
					$("#consistency_flag").val("1");
				} else {
					$("#consistency_flag").val("0");
				}
			}
		}); 
		
		//完整性监控开关
		$('#share_switch_div_integrity input').bootstrapSwitch({
			onText : "ON",
			offText : "OFF",
			onColor : "primary",
			offColor : "danger",
			size : "small",
			state : false,
			onInit : function(event, state) {//初始化开关
				$("#integrity_flag").val("0");
			},
			onSwitchChange : function(event, state) {//开关状态发生改变时
				if (state == true) {
					$("#integrity_flag").val("1");
				} else {
					$("#integrity_flag").val("0");
				}
			}
		}); 
		
		//运行状态开关
		$('#switch_run_div input').bootstrapSwitch({
			onText : "ON",
			offText : "OFF",
			onColor : "primary",
			offColor : "danger",
			size : "small",
			state : false,
			onInit : function(event, state) {//初始化开关
				$("#switch_run").val("0");
			},
			onSwitchChange : function(event, state) {//开关状态发生改变时
				if (state == true) {
					$("#switch_run").val("1");
				} else {
					$("#switch_run").val("0");
				}
			}
		}); 
		//表格横向滚动条
		function scrollX(){
			$(".ui-jqgrid-bdiv").css("width","100%")
			$(".ui-jqgrid-bdiv").css("overflow-x","scroll");
			$("#pager_list").css("width","100%");
			$("#gbox_table_list").css("width","100%");
			$("#gview_table_list").css("width","100%");
			$(".table-responsive").css("overflow-x","hidden");
		}
		
	</script>
</body>
</html>